#include "utilities.h"

int main()
{
    int nKey = 400;
    ShareMemory<TestData2> shareMemoryTestData(nKey);

    TestData2 &testData = shareMemoryTestData.Get();
    {
        std::lock_guard<tbb::detail::d1::spin_rw_mutex> lck(testData.m_mutex);
        testData.m_procCount++;
    }

    while (testData.m_procCount < 2)
    {
        std::this_thread::yield();
    }

    std::cout << "main run." << std::endl;

    if (testData.m_procCount >= 2)
    {
        for (int i = 0; i < 100000; ++i)
        {
            testData.m_mutex.lock();
            testData.m_count++;
            // char *pA = nullptr;
            // *pA = 1;
            return 0;
        }
    }
    return 0;
}
